import { IPSDEFGroup } from './ipsdefgroup';
import { IPSDEFGroupDetail } from './ipsdefgroup-detail';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEFGroupImpl extends PSModelObjectImpl implements IPSDEFGroup {
  get codeName(): string {
    return this.M.codeName;
  }

  get codeName2(): string {
    return this.M.codeName2;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get groupTag(): string {
    return this.M.groupTag;
  }

  get groupTag2(): string {
    return this.M.groupTag2;
  }

  get groupType(): 'FIELDS' | 'FORMITEMS' | 'BASEFIELDS' | 'AUDITFIELDS' {
    return this.M.groupType;
  }

  get logicMode(): 'SORT' | 'NOTSAME' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.logicMode;
  }

  get logicParam(): string {
    return this.M.logicParam;
  }

  get logicParam2(): string {
    return this.M.logicParam2;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue;
  }

  protected psdefgroupdetails: IPSDEFGroupDetail[] | null = null;

  getPSDEFGroupDetails(): IPSDEFGroupDetail[] | null {
    if (this.psdefgroupdetails == null) {
      this.psdefgroupdetails = this.fillChildListModel(this.M.getPSDEFGroupDetails, 'dataentity.defield.IPSDEFGroupDetail') as IPSDEFGroupDetail[];
    }
    return this.psdefgroupdetails;
  }

  get psDEFGroupDetails(): IPSDEFGroupDetail[] | null {
    return this.getPSDEFGroupDetails();
  }

  findPSDEFGroupDetail(objKey: any): IPSDEFGroupDetail | null {
    return this.getPSModel5('dataentity.defield.IPSDEFGroupDetail', this.getPSDEFGroupDetails(), objKey) as IPSDEFGroupDetail;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEFGroupImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'dataentity.defield.IPSDEFGroup') return true;
    return super.instanceof(cls);
  }
}
